﻿using System;
using RbacLib;
using RbacLib.Models;

namespace RBAC.Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //Privilege();
            const int projectId = 1;
            var service = new Service(projectId);
            service.AutoGenerate();

            //var allClass = Service.GetAllClass(1);
        }

        private static void Privilege()
        {
            var password = "p@ssword";
            var username = "Administrator";
            var service = new Service(1);
            var userProfile = service.Login(new LoginCriteria { Password = password, Username = username }).Data;
            var domianName = RbacEnum.Domain.User.ToString();
            var functionName = (int)RbacEnum.Function.Add;

            var privilegeClass =
                Service.PrivilageClass(new PrivilegeClassCriteria { DomainName = domianName, UserProfile = userProfile }).Data;
            var privilegeFunction =
                Service.PrivilegeFunction(new PrivilegeFunctionCriteria { DomainName = domianName, FunctionName = functionName, UserProfile = userProfile })
                    .Data;

            Console.WriteLine("privilegeClass       :{0}", privilegeClass);
            Console.WriteLine("privilegeFunction    :{0}", privilegeFunction);
            Console.ReadKey();
        }
    }
}
